import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import { Message } from "element-ui";
import 'element-ui/lib/theme-chalk/index.css';

//字体请求
import './common/font/font.css'
import './assets/common.css'
import './assets/css/reset.css'; //样式重置
import { obj } from './assets/js/rem'; //自适应
import 'font-awesome/css/font-awesome.min.css'; //字体库
//axios 异步请求
import axios from 'axios';
import VueAxios from 'vue-axios';
Vue.use(VueAxios, axios);
// Vue.use(VueI18n);

// const i18n = new VueI18n({
//   locale: 'zh',
//   messages
// });
//vant
import Vant from 'vant';
import 'vant/lib/index.css';
Vue.use(Vant);

Vue.prototype.$message = Message                //vue实例上挂载Message
// Vue.prototype.$messagebox = MessageBox

// 引入swiper
import { Swipe, SwipeItem } from 'vant';

Vue.use(Swipe);
Vue.use(SwipeItem);


//map
// import BaiduMap from 'vue-baidu-map'
//
// Vue.use(BaiduMap, {
//   // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
//   ak: 'd44oHULzxHzBFFRqjGnIyhLb2AVe6ATO'
// })

//引入筛选下拉框
import { DropdownMenu, DropdownItem } from 'vant';
Vue.use(DropdownMenu);
Vue.use(DropdownItem);

Vue.config.productionTip = false;
// Vue.prototype.axios=axios;

axios.defaults.baseURL="http://192.168.1.49:9999";

axios.interceptors.request.use(
    config => {
      var token = localStorage.getItem("token");
      if(token){
        config.headers.token=token;
      }
      return config;
    },
    error => {
      console.log(error);
      return Promise.reject();
    }
);

import Router from 'vue-router'
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}
new Vue({
  router,
  store,
    data:function(){
      return{
          shopId:'',
          typeId:'1',
          list_r:[],
          car:{},
          order:{},
          image:''
      }
    },
  mounted() {
    // 自适应
    obj.setRem();
    window.onresize = obj.setRem;
    this.$router.push('/login')
  },
  render: h => h(App)
}).$mount('#app')
